import { stringify, SipServiceOptions, SipMessage, SipRemote, SipService } from "../lib";

function printfSipMessage(message: any, title: string): void {
    console.log("===================================================================");
    console.log(title);
    console.log("===================================================================");
    console.log(stringify(message));
    console.log("===================================================================");
};

const options: SipServiceOptions = {
    "port": 15061
};

const server = new SipService(options);
server.addListener("data", async (message: SipMessage, remote: SipRemote, stream?: Buffer) => {
    printfSipMessage(message, "onMessage");
});

console.log(`SIP server start listen port:${options.port}`);

